import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../views/layout/Index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/main',
      name: 'layout',
      component: Layout,
      redirect: '/main/home',
      children:[
        {
          path: 'home',
          name: 'home',
          component: ()=>import('../views/home/Index.vue'),
          meta:{title:'home'}
        },{
          path: 'setting',
          name: 'setting',
          component: ()=>import('../views/setting/Index.vue'),
        },{
          path: 'about',
          name: 'about',
          component: ()=>import('../views/about/Index.vue')
        },{
          path: 'urls',
          name: 'urls',
          component: ()=>import('../views/urls/Index.vue')
        },{
          path: 'pass',
          name: 'pass',
          component: ()=>import('../views/pass/Index.vue')
        },{
          path: 'todo',
          name: 'todo',
          component: ()=>import('../views/todo/Index.vue')
        }
      ]
    },
    {
      path: '/',
      name: 'login',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/login/Index.vue')
    }
  ]
})

export default router
